package com.iceflame.zxingane.funs;

import android.hardware.Camera;

import com.adobe.fre.FREContext;
import com.adobe.fre.FREFunction;
import com.adobe.fre.FREObject;
import com.adobe.fre.FREWrongThreadException;

public class GetCameraMode implements FREFunction {

	@Override
	public FREObject call(FREContext arg0, FREObject[] arg1) {
		Camera camera = Camera.open();            
		Camera.Parameters parameters = camera.getParameters(); 
		String previewSizeValueString = parameters.get("preview-size-values");
		if (previewSizeValueString == null) {
			previewSizeValueString = parameters.get("preview-size-value");
		}
		camera.release();
		FREObject str = null;
		try {
			str = FREObject.newObject(previewSizeValueString);
		} catch (FREWrongThreadException e) {}
		return str;
	}
}
